﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using XLua;
public class LuaServer
{

    private static List<LuaFunction> luaServices;

	public static void Init()
    {
        luaServices = new List<LuaFunction>();

    }
	
	// Update is called once per frame
	public static void OnUpdate ()
    {
        for (int i = 0; i < luaServices.Count; i++)
        {
            luaServices[i].Call();
        }
	}

    public static void OnAddService(LuaFunction func)
    {
        if(!luaServices.Contains(func))
        {
            luaServices.Add(func);
        }
    }

    public static void OnRmoveService(LuaFunction func)
    {
        if (luaServices.Contains(func))
        {
            luaServices.Remove(func);
        }
    }
}
